
#include "HTTP.h"
#include "HTTP/Connection.h"
#include "LWP.h"

#include <iostream>
#include <string>

using namespace std;
using namespace HTTP;


int main()
{
	RequestObject req("www.google.com");
	ResponseObject resp(req.host());

	req.add_header("user-agent", LWP::LWP_AGENT);
	req.add_header("connection", "close");

//	single_request(req, resp);
	redirectable_request(req, resp);
	if(!resp.is_success())
	{
		cout<<"Error"<<endl;
		cout<<resp.get_error()<<endl;
		cout<<resp.status_line()<<endl;
		return 0;
	}
	else
		cout<<"Success"<<endl;
//	cout<<"header length: "<<resp.header_string().length()<<endl;
//	cout<<resp.header_string();
//	cout<<resp.content()<<endl;
}


